 var rname="";
  $(function(){
	  var result=parent.dataDetail;
 		loadBaseInfo(result);
 		loadReferral();
});
function loadBaseInfo(result){	
	console.log(result);
	 $("input[name=name]").val(result.name);
	$("#id").val(result.id);
	$("input[name=rcode]").val(result.rcode);
	rname=result.referralName; 
}
 
  
 
//重新渲染表单
 function renderForm(){
   layui.use('form', function(){
    var form = layui.form;//高版本建议把括号去掉，有的低版本，需要加()
    	  form.render();
   });
  }
 layui.use(['layer','form','element'], function(){
	    var layer = layui.layer,
	        $ = layui.jquery;
	    var form = layui.form;
	     form.on('submit(referralEditSave)', function(data){
	    	 $.ajax({
	 			cache: true,
	 			type: "POST",
	 			url:  "/dms-web/broke/rakeBack/editReferral",
	 			data: $('#referral').serialize(),// 你的formid,获取所有值
	 			async: false,
	 			 
	 			success: function(data) { 
	 				if(data.status==0){
	 					 Layer.showSucMsg("修改成功");
	 					parent.layer.closeAll();
   					    parent.location.reload();
	 				}else{
	 					Layer.showFailMsg("修改失败");
	 				}
	 			 
	 					 
	 			},
	 			error: function(data) { 
	 		 		Layer.showFailMsg("操作失败");
	 		 	}
	 		}); 
	       return false;
	     }); 
 });
 renderForm();
 
   